package com.sixth.statistics.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sixth.core.entity.CareOrderItem;
import com.sixth.core.vo.R;
import com.sixth.statistics.service.CareOrderItemService;
import com.sixth.statistics.vo.CareOrderItemVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: six-hospital-system
 * @description: 处理护理订单项目统计的控制器
 * @author: 朱永奇
 * @create: 2024-08-17 17:29
 **/
@RestController
@RequestMapping("/statistics/careOrderItem")
@Api(tags = "药品和检查销售统计")
public class CareOrderItemController {

    @Autowired
    private CareOrderItemService careOrderItemService;

    @PostMapping("/listByPage")
    @ApiOperation(value = "分页药品销售统计", notes = "获取分页的药品销售统计数据")
    @Transactional(readOnly = true)
    public R<IPage<CareOrderItem>> list(
            @ApiParam(value = "分页查询条件", required = true) @RequestBody CareOrderItemVo careOrderItemVo) {
        return careOrderItemService.selectByPage(careOrderItemVo);
    }

    @PostMapping("/listByString")
    @ApiOperation(value = "药品总数统计", notes = "获取药品总数统计数据")
    public R<List<CareOrderItem>> listR(@RequestBody CareOrderItemVo careOrderItemVo) {
        return careOrderItemService.selectCare(careOrderItemVo);
    }

    @PostMapping("/listById")
    @ApiOperation(value = "检查总数统计", notes = "获取检查总数统计数据")
    public R<List<CareOrderItem>> listC(@RequestBody CareOrderItemVo careOrderItemVo) {
        return careOrderItemService.selectCareOrder(careOrderItemVo);
    }
}
